package appconfig

import (
	"github.com/spf13/viper"
	"github.com/zeromicro/go-zero/core/logx"
)

type AppConfig struct {
	Jwt
	QiNiuYun
}
type Jwt struct {
	SecretKey string
}

type QiNiuYun struct {
	AccessKey string
	SecretKey string
	Bucket    string
	Url       string
}

var AppConf AppConfig

func Init() {
	viper.SetConfigFile("./appconfig/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		panic(err)
	}
	err = viper.Unmarshal(&AppConf)
	if err != nil {
		panic(err)
	} else {
		logx.Info("动态配置读取成功:", AppConf)
	}
}
